/**
 * Copyright:Copyright (C) 2014-2016
 * Cpmpany:安徽东位信息科技有限责任公司
 * All Rights Reserved
 * 
 * 名称：LBSDataLink SDK Demo
 * 版本：V0.0.1
 * 
 * Author:Riven
 * QQ:508620006
 * 
 * 数据采集服务 
 */
package com.lbssoft.gpsbd.datalink;

import com.lbssoft.datalink.SubServer;
import com.lbssoft.datalink.util.Log;
import com.lbssoft.gpsbd.common.Constant;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;

public class Server {

	public static void Start(ApplicationContext applicationContext){
		Environment env = applicationContext.getEnvironment();
		if(Boolean.valueOf(env.getProperty("gpsbd.install"))){
			String  appsecret = env.getProperty("gpsbd.appsecret");
			Context.init();
			if(!Constant.DEV_MODE){
				try {
					new SubServer().connect(appsecret, new Listener());
					Log.info("Starting GPSBD Server...");
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}else{
			Log.info("GPSBD系统没有初始化进入安装界面.");
		}

	}



	
}
